home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / info / xemacs.info-5 < prev    next >
Encoding:
GNU Info File  |  1995-09-01  |  49.8 KB  |  1,179 lines

  1. This is Info file ../../info/xemacs.info, produced by Makeinfo-1.63
  2. from the input file xemacs.texi.
  3.  
  4.    This file documents the XEmacs editor.
  5.  
  6.    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.  Copyright (C)
  7. 1991, 1992, 1993, 1994 Lucid, Inc.  Copyright (C) 1993, 1994 Sun
  8. Microsystems, Inc.  Copyright (C) 1995 Amdahl Corporation.
  9.  
  10.    Permission is granted to make and distribute verbatim copies of this
  11. manual provided the copyright notice and this permission notice are
  12. preserved on all copies.
  13.  
  14.    Permission is granted to copy and distribute modified versions of
  15. this manual under the conditions for verbatim copying, provided also
  16. that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
  17. General Public License" are included exactly as in the original, and
  18. provided that the entire resulting derived work is distributed under the
  19. terms of a permission notice identical to this one.
  20.  
  21.    Permission is granted to copy and distribute translations of this
  22. manual into another language, under the above conditions for modified
  23. versions, except that the sections entitled "The GNU Manifesto",
  24. "Distribution" and "GNU General Public License" may be included in a
  25. translation approved by the author instead of in the original English.
  26.  
  27. 
  28. File: xemacs.info,  Node: Active Regions,  Prev: X Cut Buffers,  Up: Using X Selections
  29.  
  30. Active Regions
  31. --------------
  32.  
  33.    By default, both the text you select in an Emacs buffer using the
  34. click-and-drag mechanism and text you select by setting point and the
  35. mark is highlighted. You can use Emacs region commands as well as the
  36. Cut and Copy commands on the highlighted region you selected with the
  37. mouse.
  38.  
  39.    If you prefer, you can make a distinction between text selected with
  40. the mouse and text selected with point and the mark by setting the
  41. variable `zmacs-regions' to `nil'.  In that case:
  42.  
  43.    * The text selected with the mouse becomes both the X selection and
  44.      the Emacs selected region. You can use menu-bar commands as well
  45.      as Emacs region commands on it.
  46.  
  47.    * The text selected with point and the mark is not highlighted. You
  48.      can only use Emacs region commands on it, not the menu-bar items.
  49.  
  50.    Active regions originally come from Zmacs, the Lisp Machine editor.
  51. The idea behind them is that commands can only operate on a region when
  52. the region is in an "active" state.  Put simply, you can only operate on
  53. a region that is highlighted.
  54.  
  55.    The variable `zmacs-regions' checks whether LISPM-style active
  56. regions should be used.  This means that commands that operate on the
  57. region (the area between point and the mark) only work while the region
  58. is in the active state, which is indicated by highlighting.  Most
  59. commands causes the region to not be in the active state; for example,
  60. `C-w' only works immediately after activating the region.
  61.  
  62.    More specifically:
  63.    * Commands that operate on the region only work if the region is
  64.      active.
  65.  
  66.    * Only a very small set of commands causes the region to become
  67.      active-- those commands whose semantics are to mark an area, such
  68.      as `mark-defun'.
  69.  
  70.    * The region is deactivated after each command that is executed,
  71.      except that motion commands do not change whether the region is
  72.      active or not.
  73.  
  74.    `set-mark-command' (`C-SPC') pushes a mark and activates the region.
  75. Moving the cursor with normal motion commands (`C-n', `C-p', etc.)
  76. will cause the region between point and the recently-pushed mark to be
  77. highlighted.  It will remain highlighted until some non-motion comand
  78. is executed.
  79.  
  80.    `exchange-point-and-mark' (`C-x C-x') activates the region.  So if
  81. you mark a region and execute a command that operates on it, you can
  82. reactivate the same region with `C-x C-x' (or perhaps `C-x C-x C-x
  83. C-x') to operate on it again.
  84.  
  85.    Generally, commands that push marks as a means of navigation, such as
  86. `beginning-of-buffer' (`M-<') and `end-of-buffer' (`M->'), do not
  87. activate the region.  However, commands that push marks as a means of
  88. marking an area of text, such as `mark-defun' (`M-C-h'), `mark-word'
  89. (`M-@'), and `mark-whole-buffer' (`C-x h'), do activate the region.
  90.  
  91.    When `zmacs-regions' is `t', there is no distinction between the
  92. primary X selection and the active region selected by point and the
  93. mark.  To see this, set the mark (C-SPC) and move the cursor with any
  94. cursor-motion command: the region between point and mark is
  95. highlighted, and you can watch it grow and shrink as you move the
  96. cursor.
  97.  
  98.    Any other commands besides cursor-motion commands (such as inserting
  99. or deleting text) will cause the region to no longer be active; it will
  100. no longer be highlighted, and will no longer be the primary selection.
  101. Errors also remove highlighting from a region.
  102.  
  103.    Commands that require a region (such as `C-w') signal an error if
  104. the region is not active.  Certain commands cause the region to be in
  105. its active state.  The most common ones are `push-mark' (C-SPC) and
  106. `exchange-point-and-mark' (`C-x C-x').
  107.  
  108.    When `zmacs-regions' is `t', programs can be non-intrusive on the
  109. state of the region by setting the variable `zmacs-region-stays' to a
  110. non-`nil' value.  If you are writing a new Emacs command that is
  111. conceptually a "motion" command and should not interfere with the
  112. current highlightedness of the region, then you may set this variable.
  113. It is reset to `nil' after each user command is executed.
  114.  
  115.    When `zmacs-regions' is `t', programs can make the region between
  116. point and mark go into the active (highlighted) state by using the
  117. function `zmacs-activate-region'. Only a small number of commands
  118. should ever do this.
  119.  
  120.    When `zmacs-regions' is `t', programs can deactivate the region
  121. between point and the mark by using `zmacs-deactivate-region'.  Note:
  122. you should not have to call this function; the command loop calls it
  123. when appropriate.
  124.  
  125. 
  126. File: xemacs.info,  Node: Accumulating Text,  Next: Rectangles,  Prev: Using X Selections,  Up: Top
  127.  
  128. Accumulating Text
  129. =================
  130.  
  131.    Usually you copy or move text by killing it and yanking it, but
  132. there are other ways that are useful for copying one block of text in
  133. many places, or for copying many scattered blocks of text into one
  134. place.
  135.  
  136.    If you like, you can accumulate blocks of text from scattered
  137. locations either into a buffer or into a file.  The relevant commands
  138. are described here.  You can also use Emacs registers for storing and
  139. accumulating text.  *Note Registers::.
  140.  
  141. `M-x append-to-buffer'
  142.      Append region to contents of specified buffer (`append-to-buffer').
  143.  
  144. `M-x prepend-to-buffer'
  145.      Prepend region to contents of specified buffer.
  146.  
  147. `M-x copy-to-buffer'
  148.      Copy region into specified buffer, deleting that buffer's old
  149.      contents.
  150.  
  151. `M-x insert-buffer'
  152.      Insert contents of specified buffer into current buffer at point.
  153.  
  154. `M-x append-to-file'
  155.      Append region to the end of the contents of specified file.
  156.  
  157.    To accumulate text into a buffer, use the command `M-x
  158. append-to-buffer', which inserts a copy of the region into the buffer
  159. BUFFERNAME, at the location of point in that buffer.  If there is no
  160. buffer with the given name, one is created.
  161.  
  162.    If you append text to a buffer that has been used for editing, the
  163. copied text goes to the place where point is.  Point in that buffer is
  164. left at the end of the copied text, so successive uses of
  165. `append-to-buffer' accumulate the text in the specified buffer in the
  166. same order as they were copied.  Strictly speaking, this command does
  167. not always append to the text already in the buffer; but if this command
  168. is the only command used to alter a buffer, it does always append to the
  169. existing text because point is always at the end.
  170.  
  171.    `M-x prepend-to-buffer' is similar to `append-to-buffer', but point
  172. in the other buffer is left before the copied text, so successive
  173. prependings add text in reverse order.  `M-x copy-to-buffer' is
  174. similar, except that any existing text in the other buffer is deleted,
  175. so the buffer is left containing just the text newly copied into it.
  176.  
  177.    You can retrieve the accumulated text from that buffer with `M-x
  178. insert-buffer', which takes BUFFERNAME as an argument.  It inserts a
  179. copy of the text in buffer BUFFERNAME into the selected buffer.  You
  180. could alternatively select the other buffer for editing, perhaps moving
  181. text from it by killing or with `append-to-buffer'.  *Note Buffers::,
  182. for background information on buffers.
  183.  
  184.    Instead of accumulating text within Emacs in a buffer, you can append
  185. text directly into a file with `M-x append-to-file', which takes
  186. FILE-NAME as an argument.  It adds the text of the region to the end of
  187. the specified file.  The file is changed immediately on disk.  This
  188. command is normally used with files that are not being visited in
  189. Emacs.  Using it on a file that Emacs is visiting can produce confusing
  190. results, because the file's text inside Emacs does not change while the
  191. file itself changes.
  192.  
  193. 
  194. File: xemacs.info,  Node: Rectangles,  Next: Registers,  Prev: Accumulating Text,  Up: Top
  195.  
  196. Rectangles
  197. ==========
  198.  
  199.    The rectangle commands affect rectangular areas of text: all
  200. characters between a certain pair of columns, in a certain range of
  201. lines.  Commands are provided to kill rectangles, yank killed
  202. rectangles, clear them out, or delete them.  Rectangle commands are
  203. useful with text in multicolumnar formats, like code with comments at
  204. the right, or for changing text into or out of such formats.
  205.  
  206.    To specify the rectangle a command should work on, put the mark at
  207. one corner and point at the opposite corner.  The specified rectangle is
  208. called the "region-rectangle" because it is controlled about the same
  209. way the region is controlled.  Remember that a given combination of
  210. point and mark values can be interpreted either as specifying a region
  211. or as specifying a rectangle; it is up to the command that uses them to
  212. choose the interpretation.
  213.  
  214. `M-x delete-rectangle'
  215.      Delete the text of the region-rectangle, moving any following text
  216.      on each line leftward to the left edge of the region-rectangle.
  217.  
  218. `M-x kill-rectangle'
  219.      Similar, but also save the contents of the region-rectangle as the
  220.      "last killed rectangle".
  221.  
  222. `M-x yank-rectangle'
  223.      Yank the last killed rectangle with its upper left corner at point.
  224.  
  225. `M-x open-rectangle'
  226.      Insert blank space to fill the space of the region-rectangle.  The
  227.      previous contents of the region-rectangle are pushed rightward.
  228.  
  229. `M-x clear-rectangle'
  230.      Clear the region-rectangle by replacing its contents with spaces.
  231.  
  232.    The rectangle operations fall into two classes: commands deleting and
  233. moving rectangles, and commands for blank rectangles.
  234.  
  235.    There are two ways to get rid of the text in a rectangle: you can
  236. discard the text (delete it) or save it as the "last killed" rectangle.
  237. The commands for these two ways are `M-x delete-rectangle' and `M-x
  238. kill-rectangle'.  In either case, the portion of each line that falls
  239. inside the rectangle's boundaries is deleted, causing following text
  240. (if any) on the line to move left.
  241.  
  242.    Note that "killing" a rectangle is not killing in the usual sense;
  243. the rectangle is not stored in the kill ring, but in a special place
  244. that only records the most recently killed rectangle (that is, does not
  245. append to a killed rectangle).  Different yank commands have to be used
  246. and only one rectangle is stored, because yanking a rectangle is quite
  247. different from yanking linear text and yank-popping commands are
  248. difficult to make sense of.
  249.  
  250.    Inserting a rectangle is the opposite of deleting one.  You specify
  251. where to put the upper left corner by putting point there.  The
  252. rectangle's first line is inserted at point, the rectangle's second line
  253. is inserted at a point one line vertically down, and so on.  The number
  254. of lines affected is determined by the height of the saved rectangle.
  255.  
  256.    To insert the last killed rectangle, type `M-x yank-rectangle'.
  257. This can be used to convert single-column lists into double-column
  258. lists; kill the second half of the list as a rectangle and then yank it
  259. beside the first line of the list.
  260.  
  261.    There are two commands for working with blank rectangles: `M-x
  262. clear-rectangle' erases existing text, and `M-x open-rectangle' inserts
  263. a blank rectangle.  Clearing a rectangle is equivalent to deleting it
  264. and then inserting a blank rectangle of the same size.
  265.  
  266.    Rectangles can also be copied into and out of registers.  *Note
  267. Rectangle Registers: RegRect.
  268.  
  269. 
  270. File: xemacs.info,  Node: Registers,  Next: Display,  Prev: Rectangles,  Up: Top
  271.  
  272. Registers
  273. *********
  274.  
  275.    Emacs "registers" are places in which you can save text or positions
  276. for later use.  Text saved in a register can be copied into the buffer
  277. once or many times; a position saved in a register is used by moving
  278. point to that position.  Rectangles can also be copied into and out of
  279. registers (*note Rectangles::.).
  280.  
  281.    Each register has a name, which is a single character.  A register
  282. can store either a piece of text, a position, or a rectangle, but only
  283. one thing at any given time.  Whatever you store in a register remains
  284. there until you store something else in that register.
  285.  
  286. * Menu:
  287.  
  288. * RegPos::    Saving positions in registers.
  289. * RegText::   Saving text in registers.
  290. * RegRect::   Saving rectangles in registers.
  291.  
  292. `M-x view-register RET R'
  293.      Display a description of what register R contains.
  294.  
  295.    `M-x view-register' reads a register name as an argument and then
  296. displays the contents of the specified register.
  297.  
  298. 
  299. File: xemacs.info,  Node: RegPos,  Next: RegText,  Prev: Registers,  Up: Registers
  300.  
  301. Saving Positions in Registers
  302. =============================
  303.  
  304.    Saving a position records a spot in a buffer so you can move back
  305. there later.  Moving to a saved position re-selects the buffer and
  306. moves point to the spot.
  307.  
  308. `C-x r SPC R'
  309.      Save the location of point in register R (`point-to-register').
  310.  
  311. `C-x r j R'
  312.      Jump to the location saved in register R (`register-to-point').
  313.  
  314.    To save the current location of point in a register, choose a name R
  315. and type `C-x r SPC R'.  The register R retains the location thus saved
  316. until you store something else in that register.
  317.  
  318.    The command `C-x r j R' moves point to the location recorded in
  319. register R.  The register is not affected; it continues to record the
  320. same location.  You can jump to the same position using the same
  321. register as often as you want.
  322.  
  323. 
  324. File: xemacs.info,  Node: RegText,  Next: RegRect,  Prev: RegPos,  Up: Registers
  325.  
  326. Saving Text in Registers
  327. ========================
  328.  
  329.    When you want to insert a copy of the same piece of text many times,
  330. it can be impractical to use the kill ring, since each subsequent kill
  331. moves the piece of text further down on the ring.  It becomes hard to
  332. keep track of the argument needed to retrieve the same text with `C-y'.
  333. An alternative is to store the text in a register with `C-x r s'
  334. (`copy-to-register') and then retrieve it with `C-x r g'
  335. (`insert-register').
  336.  
  337. `C-x r s R'
  338.      Copy region into register R (`copy-to-register').
  339.  
  340. `C-x r g R'
  341.      Insert text contents of register R (`insert-register').
  342.  
  343.    `C-x r s R' stores a copy of the text of the region into the
  344. register named R.  Given a numeric argument, `C-x r s' deletes the text
  345. from the buffer as well.
  346.  
  347.    `C-x r g R' inserts the text from register R in the buffer.  By
  348. default it leaves point before the text and places the mark after it.
  349. With a numeric argument, it puts point after the text and the mark
  350. before it.
  351.  
  352. 
  353. File: xemacs.info,  Node: RegRect,  Prev: RegText,  Up: Registers
  354.  
  355. Saving Rectangles in Registers
  356. ==============================
  357.  
  358.    A register can contain a rectangle instead of lines of text.  The
  359. rectangle is represented as a list of strings.  *Note Rectangles::, for
  360. basic information on rectangles and how to specify rectangles in a
  361. buffer.
  362.  
  363. `C-x r r R'
  364.      Copy the region-rectangle into register
  365.      R(`copy-rectangle-to-register').  With a numeric argument, delete
  366.      it as well.
  367.  
  368. `C-x r g R'
  369.      Insert the rectangle stored in register R (if it contains a
  370.      rectangle) (`insert-register').
  371.  
  372.    The `C-x r g' command inserts linear text if the register contains
  373. that, or inserts a rectangle if the register contains one.
  374.  
  375. 
  376. File: xemacs.info,  Node: Display,  Next: Search,  Prev: Registers,  Up: Top
  377.  
  378. Controlling the Display
  379. ***********************
  380.  
  381.    Since only part of a large buffer fits in the window, Emacs tries to
  382. show the part that is likely to be interesting.  The display control
  383. commands allow you to specify which part of the text you want to see.
  384.  
  385. `C-l'
  386.      Clear frame and redisplay, scrolling the selected window to center
  387.      point vertically within it (`recenter').
  388.  
  389. `C-v'
  390.      Scroll forward (a windowful or a specified number of lines)
  391.      (`scroll-up').
  392.  
  393. `M-v'
  394.      Scroll backward (`scroll-down').
  395.  
  396. `ARG C-l'
  397.      Scroll so point is on line ARG (`recenter').
  398.  
  399. `C-x <'
  400.      Scroll text in current window to the left (`scroll-left').
  401.  
  402. `C-x >'
  403.      Scroll to the right (`scroll-right').
  404.  
  405. `C-x $'
  406.      Make deeply indented lines invisible (`set-selective-display').
  407.  
  408. * Menu:
  409.  
  410. * Scrolling::               Moving text up and down in a window.
  411. * Horizontal Scrolling::   Moving text left and right in a window.
  412. * Selective Display::      Hiding lines with lots of indentation.
  413. * Display Vars::           Information on variables for customizing display.
  414.  
  415. 
  416. File: xemacs.info,  Node: Scrolling,  Next: Horizontal Scrolling,  Prev: Display,  Up: Display
  417.  
  418. Scrolling
  419. =========
  420.  
  421.    If a buffer contains text that is too large to fit entirely within
  422. the window that is displaying the buffer, Emacs shows a contiguous
  423. section of the text.  The section shown always contains point.
  424.  
  425.    "Scrolling" means moving text up or down in the window so that
  426. different parts of the text are visible.  Scrolling forward means that
  427. text moves up, and new text appears at the bottom.  Scrolling backward
  428. moves text down and new text appears at the top.
  429.  
  430.    Scrolling happens automatically if you move point past the bottom or
  431. top of the window.  You can also explicitly request scrolling with the
  432. commands in this section.
  433.  
  434. `C-l'
  435.      Clear frame and redisplay, scrolling the selected window to center
  436.      point vertically within it (`recenter').
  437.  
  438. `C-v'
  439.      Scroll forward (a windowful or a specified number of lines)
  440.      (`scroll-up').
  441.  
  442. `M-v'
  443.      Scroll backward (`scroll-down').
  444.  
  445. `ARG C-l'
  446.      Scroll so point is on line ARG (`recenter').
  447.  
  448.    The most basic scrolling command is `C-l' (`recenter') with no
  449. argument.  It clears the entire frame and redisplays all windows.  In
  450. addition, it scrolls the selected window so that point is halfway down
  451. from the top of the window.
  452.  
  453.    The scrolling commands `C-v' and `M-v' let you move all the text in
  454. the window up or down a few lines.  `C-v' (`scroll-up') with an
  455. argument shows you that many more lines at the bottom of the window,
  456. moving the text and point up together as `C-l' might.  `C-v' with a
  457. negative argument shows you more lines at the top of the window.
  458. `Meta-v' (`scroll-down') is like `C-v', but moves in the opposite
  459. direction.
  460.  
  461.    To read the buffer a windowful at a time, use `C-v' with no
  462. argument.  `C-v' takes the last two lines at the bottom of the window
  463. and puts them at the top, followed by nearly a whole windowful of lines
  464. not previously visible.  Point moves to the new top of the window if it
  465. was in the text scrolled off the top.  `M-v' with no argument moves
  466. backward with similar overlap.  The number of lines of overlap across a
  467. `C-v' or `M-v' is controlled by the variable
  468. `next-screen-context-lines'; by default, it is two.
  469.  
  470.    Another way to scroll is using `C-l' with a numeric argument.  `C-l'
  471. does not clear the frame when given an argument; it only scrolls the
  472. selected window.  With a positive argument N, `C-l' repositions text to
  473. put point N lines down from the top.  An argument of zero puts point on
  474. the very top line.  Point does not move with respect to the text;
  475. rather, the text and point move rigidly on the frame.  `C-l' with a
  476. negative argument puts point that many lines from the bottom of the
  477. window.  For example, `C-u - 1 C-l' puts point on the bottom line, and
  478. `C-u - 5 C-l' puts it five lines from the bottom.  Just `C-u' as
  479. argument, as in `C-u C-l', scrolls point to the center of the frame.
  480.  
  481.    Scrolling happens automatically if point has moved out of the visible
  482. portion of the text when it is time to display.  Usually scrolling is
  483. done  to put point vertically centered within the window.  However, if
  484. the variable `scroll-step' has a non-zero value, an attempt is made to
  485. scroll the buffer by that many lines; if that is enough to bring point
  486. back into visibility, that is what happens.
  487.  
  488. 
  489. File: xemacs.info,  Node: Horizontal Scrolling,  Prev: Scrolling,  Up: Display
  490.  
  491. Horizontal Scrolling
  492. ====================
  493.  
  494. `C-x <'
  495.      Scroll text in current window to the left (`scroll-left').
  496.  
  497. `C-x >'
  498.      Scroll to the right (`scroll-right').
  499.  
  500.    The text in a window can also be scrolled horizontally.  This means
  501. that each line of text is shifted sideways in the window, and one or
  502. more characters at the beginning of each line are not displayed at all.
  503. When a window has been scrolled horizontally in this way, text lines
  504. are truncated rather than continued (*note Continuation Lines::.), with
  505. a `$' appearing in the first column when there is text truncated to the
  506. left, and in the last column when there is text truncated to the right.
  507.  
  508.    The command `C-x <' (`scroll-left') scrolls the selected window to
  509. the left by N columns with argument N.  With no argument, it scrolls by
  510. almost the full width of the window (two columns less, to be precise).
  511. `C-x >' (`scroll-right') scrolls similarly to the right.  The window
  512. cannot be scrolled any farther to the right once it is displaying
  513. normally (with each line starting at the window's left margin);
  514. attempting to do so has no effect.
  515.  
  516. 
  517. File: xemacs.info,  Node: Selective Display,  Next: Display Vars,  Prev: Display,  Up: Display
  518.  
  519. Selective Display
  520. =================
  521.  
  522.    Emacs can hide lines indented more than a certain number of columns
  523. (you specify how many columns).  This allows you  to get an overview of
  524. a part of a program.
  525.  
  526.    To hide lines, type `C-x $' (`set-selective-display') with a numeric
  527. argument N.  (*Note Arguments::, for information on giving the
  528. argument.)  Lines with at least N columns of indentation disappear from
  529. the screen.  The only indication of their presence are three dots
  530. (`...'), which appear at the end of each visible line that is followed
  531. by one or more invisible ones.
  532.  
  533.    The invisible lines are still present in the buffer, and most editing
  534. commands see them as usual, so it is very easy to put point in the
  535. middle of invisible text.  When this happens, the cursor appears at the
  536. end of the previous line, after the three dots.  If point is at the end
  537. of the visible line, before the newline that ends it, the cursor
  538. appears before the three dots.
  539.  
  540.    The commands `C-n' and `C-p' move across the invisible lines as if
  541. they were not there.
  542.  
  543.    To make everything visible again, type `C-x $' with no argument.
  544.  
  545. 
  546. File: xemacs.info,  Node: Display Vars,  Prev: Selective Display,  Up: Display
  547.  
  548. Variables Controlling Display
  549. =============================
  550.  
  551.    This section contains information for customization only.  Beginning
  552. users should skip it.
  553.  
  554.    The variable `mode-line-inverse-video' controls whether the mode
  555. line is displayed in inverse video (assuming the terminal supports it);
  556. `nil' means don't do so.  *Note Mode Line::.
  557.  
  558.    If the variable `inverse-video' is non-`nil', Emacs attempts to
  559. invert all the lines of the display from what they normally are.
  560.  
  561.    When you reenter Emacs after suspending, Emacs normally clears the
  562. screen and redraws the entire display.  On some terminals with more than
  563. one page of memory, it is possible to arrange the termcap entry so that
  564. the `ti' and `te' strings (output to the terminal when Emacs is entered
  565. and exited, respectively) switch between pages of memory so as to use
  566. one page for Emacs and another page for other output.  In that case,
  567. you might want to set the variable `no-redraw-on-reenter' to non-`nil'
  568. so that Emacs will assume, when resumed, that the screen page it is
  569. using still contains what Emacs last wrote there.
  570.  
  571.    The variable `echo-keystrokes' controls the echoing of
  572. multi-character keys; its value is the number of seconds of pause
  573. required to cause echoing to start, or zero, meaning don't echo at all.
  574. *Note Echo Area::.
  575.  
  576.    If the variable `ctl-arrow' is `nil', control characters in the
  577. buffer are displayed with octal escape sequences, all except newline and
  578. tab.  If its value is `t', then control characters will be printed with
  579. an up-arrow, for example `^A'.
  580.  
  581.    If its value is not `t' and not `nil', then characters whose code is
  582. greater than 160 (that is, the space character (32) with its high bit
  583. set) will be assumed to be printable, and will be displayed without
  584. alteration.  This is the default when running under X Windows, since
  585. XEmacs assumes an ISO/8859-1 character set (also known as "Latin1").
  586. The `ctl-arrow' variable may also be set to an integer, in which case
  587. all characters whose codes are greater than or equal to that value will
  588. be assumed to be printable.
  589.  
  590.    Altering the value of `ctl-arrow' makes it local to the current
  591. buffer; until that time, the default value is in effect.  *Note
  592. Locals::.
  593.  
  594.    Normally, a tab character in the buffer is displayed as whitespace
  595. which extends to the next display tab stop position, and display tab
  596. stops come at intervals equal to eight spaces.  The number of spaces
  597. per tab is controlled by the variable `tab-width', which is made local
  598. by changing it, just like `ctl-arrow'.  Note that how the tab character
  599. in the buffer is displayed has nothing to do with the definition of TAB
  600. as a command.
  601.  
  602.    If you set the variable `selective-display-ellipses' to `nil', the
  603. three dots at the end of a line that precedes invisible lines do not
  604. appear.  There is no visible indication of the invisible lines.  This
  605. variable becomes local automatically when set.
  606.  
  607. 
  608. File: xemacs.info,  Node: Search,  Next: Fixit,  Prev: Display,  Up: Top
  609.  
  610. Searching and Replacement
  611. *************************
  612.  
  613.    Like other editors, Emacs has commands for searching for occurrences
  614. of a string.  The principal search command is unusual in that it is
  615. "incremental": it begins to search before you have finished typing the
  616. search string.  There are also non-incremental search commands more like
  617. those of other editors.
  618.  
  619.    Besides the usual `replace-string' command that finds all
  620. occurrences of one string and replaces them with another, Emacs has a
  621. fancy replacement command called `query-replace' which asks
  622. interactively which occurrences to replace.
  623.  
  624. * Menu:
  625.  
  626. * Incremental Search::     Search happens as you type the string.
  627. * Non-Incremental Search:: Specify entire string and then search.
  628. * Word Search::            Search for sequence of words.
  629. * Regexp Search::          Search for match for a regexp.
  630. * Regexps::                Syntax of regular expressions.
  631. * Search Case::            To ignore case while searching, or not.
  632. * Replace::                Search, and replace some or all matches.
  633. * Other Repeating Search:: Operating on all matches for some regexp.
  634.  
  635. 
  636. File: xemacs.info,  Node: Incremental Search,  Next: Non-Incremental Search,  Prev: Search,  Up: Search
  637.  
  638. Incremental Search
  639. ==================
  640.  
  641.    An incremental search begins searching as soon as you type the first
  642. character of the search string.  As you type in the search string, Emacs
  643. shows you where the string (as you have typed it so far) is found.
  644. When you have typed enough characters to identify the place you want,
  645. you can stop.  Depending on what you do next, you may or may not need to
  646. terminate the search explicitly with a RET.
  647.  
  648. `C-s'
  649.      Incremental search forward (`isearch-forward').
  650.  
  651. `C-r'
  652.      Incremental search backward (`isearch-backward').
  653.  
  654.    `C-s' starts an incremental search.  `C-s' reads characters from the
  655. keyboard and positions the cursor at the first occurrence of the
  656. characters that you have typed.  If you type `C-s' and then `F', the
  657. cursor moves right after the first `F'.  Type an `O', and see the
  658. cursor move to after the first `FO'.  After another `O', the cursor is
  659. after the first `FOO' after the place where you started the search.
  660. Meanwhile, the search string `FOO' has been echoed in the echo area.
  661.  
  662.    The echo area display ends with three dots when actual searching is
  663. going on.  When search is waiting for more input, the three dots are
  664. removed.  (On slow terminals, the three dots are not displayed.)
  665.  
  666.    If you make a mistake in typing the search string, you can erase
  667. characters with DEL.  Each DEL cancels the last character of the search
  668. string.  This does not happen until Emacs is ready to read another
  669. input character; first it must either find, or fail to find, the
  670. character you want to erase.  If you do not want to wait for this to
  671. happen, use `C-g' as described below.
  672.  
  673.    When you are satisfied with the place you have reached, you can type
  674. RET (or C-m), which stops searching, leaving the cursor where the
  675. search brought it.  Any command not specially meaningful in searches
  676. also stops the search and is then executed.  Thus, typing `C-a' exits
  677. the search and then moves to the beginning of the line.  RET is
  678. necessary only if the next command you want to type is a printing
  679. character, DEL, ESC, or another control character that is special
  680. within searches (`C-q', `C-w', `C-r', `C-s', or `C-y').
  681.  
  682.    Sometimes you search for `FOO' and find it, but were actually
  683. looking for a different occurance of it.  To move to the next occurrence
  684. of the search string, type another `C-s'.  Do this as often as
  685. necessary.  If you overshoot, you can cancel some `C-s' characters with
  686. DEL.
  687.  
  688.    After you exit a search, you can search for the same string again by
  689. typing just `C-s C-s': the first `C-s' is the key that invokes
  690. incremental search, and the second `C-s' means "search again".
  691.  
  692.    If the specified string is not found at all, the echo area displays
  693. the text `Failing I-Search'.  The cursor is after the place where Emacs
  694. found as much of your string as it could.  Thus, if you search for
  695. `FOOT', and there is no `FOOT', the cursor may be after the `FOO' in
  696. `FOOL'.  At this point there are several things you can do.  If you
  697. mistyped the search string, correct it.  If you like the place you have
  698. found, you can type RET or some other Emacs command to "accept what the
  699. search offered".  Or you can type `C-g', which removes from the search
  700. string the characters that could not be found (the `T' in `FOOT'),
  701. leaving those that were found (the `FOO' in `FOOT').  A second `C-g' at
  702. that point cancels the search entirely, returning point to where it was
  703. when the search started.
  704.  
  705.    If a search is failing and you ask to repeat it by typing another
  706. `C-s', it starts again from the beginning of the buffer.  Repeating a
  707. failing backward search with `C-r' starts again from the end.  This is
  708. called "wrapping around".  `Wrapped' appears in the search prompt once
  709. this has happened.
  710.  
  711.    The `C-g' "quit" character does special things during searches; just
  712. what it does depends on the status of the search.  If the search has
  713. found what you specified and is waiting for input, `C-g' cancels the
  714. entire search.  The cursor moves back to where you started the search.
  715. If `C-g' is typed when there are characters in the search string that
  716. have not been found--because Emacs is still searching for them, or
  717. because it has failed to find them--then the search string characters
  718. which have not been found are discarded from the search string.  The
  719. search is now successful and waiting for more input, so a second `C-g'
  720. cancels the entire search.
  721.  
  722.    To search for a control character such as `C-s' or DEL or ESC, you
  723. must quote it by typing `C-q' first.  This function of `C-q' is
  724. analogous to its meaning as an Emacs command: it causes the following
  725. character to be treated the way a graphic character would normally be
  726. treated in the same context.
  727.  
  728.    To search backwards, you can use `C-r' instead of `C-s' to start the
  729. search; `C-r' is the key that runs the command (`isearch-backward') to
  730. search backward.  You can also use `C-r' to change from searching
  731. forward to searching backwards.  Do this if a search fails because the
  732. place you started was too far down in the file.  Repeated `C-r' keeps
  733. looking for more occurrences backwards.  `C-s' starts going forward
  734. again.  You can cancel `C-r' in a search with DEL.
  735.  
  736.    The characters `C-y' and `C-w' can be used in incremental search to
  737. grab text from the buffer into the search string.  This makes it
  738. convenient to search for another occurrence of text at point.  `C-w'
  739. copies the word after point as part of the search string, advancing
  740. point over that word.  Another `C-s' to repeat the search will then
  741. search for a string including that word.  `C-y' is similar to `C-w' but
  742. copies the rest of the current line into the search string.
  743.  
  744.    The characters `M-p' and `M-n' can be used in an incremental search
  745. to recall things which you have searched for in the past.  A list of
  746. the last 16 things you have searched for is retained, and `M-p' and
  747. `M-n' let you cycle through that ring.
  748.  
  749.    The character `M-TAB' does completion on the elements in the search
  750. history ring.  For example, if you know that you have recently searched
  751. for the string `POTATOE', you could type `C-s P O M-TAB'.  If you had
  752. searched for other strings beginning with `PO' then you would be shown
  753. a list of them, and would need to type more to select one.
  754.  
  755.    You can change any of the special characters in incremental search
  756. via the normal keybinding mechanism: simply add a binding to the
  757. `isearch-mode-map'.  For example, to make the character `C-b' mean
  758. "search backwards" while in isearch-mode, do this:
  759.  
  760.      (define-key isearch-mode-map "\C-b" 'isearch-repeat-backward)
  761.  
  762.    These are the default bindings of isearch-mode:
  763.  
  764. `DEL'
  765.      Delete a character from the incremental search string
  766.      (`isearch-delete-char').
  767.  
  768. `RET'
  769.      Exit incremental search (`isearch-exit').
  770.  
  771. `C-q'
  772.      Quote special characters for incremental search
  773.      (`isearch-quote-char').
  774.  
  775. `C-s'
  776.      Repeat incremental search forward (`isearch-repeat-forward').
  777.  
  778. `C-r'
  779.      Repeat incremental search backward (`isearch-repeat-backward').
  780.  
  781. `C-y'
  782.      Pull rest of line from buffer into search string
  783.      (`isearch-yank-line').
  784.  
  785. `C-w'
  786.      Pull next word from buffer into search string
  787.      (`isearch-yank-word').
  788.  
  789. `C-g'
  790.      Cancels input back to what has been found successfully, or aborts
  791.      the isearch (`isearch-abort').
  792.  
  793. `M-p'
  794.      Recall the previous element in the isearch history ring
  795.      (`isearch-ring-retreat').
  796.  
  797. `M-n'
  798.      Recall the next element in the isearch history ring
  799.      (`isearch-ring-advance').
  800.  
  801. `M-TAB'
  802.      Do completion on the elements in the isearch history ring
  803.      (`isearch-complete').
  804.  
  805.    Any other character which is normally inserted into a buffer when
  806. typed is automatically added to the search string in isearch-mode.
  807.  
  808. Slow Terminal Incremental Search
  809. --------------------------------
  810.  
  811.    Incremental search on a slow terminal uses a modified style of
  812. display that is designed to take less time.  Instead of redisplaying
  813. the buffer at each place the search gets to, it creates a new
  814. single-line window and uses that to display the line the search has
  815. found.  The single-line window appears as soon as point gets outside of
  816. the text that is already on the screen.
  817.  
  818.    When the search is terminated, the single-line window is removed.
  819. Only at this time the window in which the search was done is
  820. redisplayed to show its new value of point.
  821.  
  822.    The three dots at the end of the search string, normally used to
  823. indicate that searching is going on, are not displayed in slow style
  824. display.
  825.  
  826.    The slow terminal style of display is used when the terminal baud
  827. rate is less than or equal to the value of the variable
  828. `search-slow-speed', initially 1200.
  829.  
  830.    The number of lines to use in slow terminal search display is
  831. controlled by the variable `search-slow-window-lines'.  Its normal
  832. value is 1.
  833.  
  834. 
  835. File: xemacs.info,  Node: Non-Incremental Search,  Next: Word Search,  Prev: Incremental Search,  Up: Search
  836.  
  837. Non-Incremental Search
  838. ======================
  839.  
  840.    Emacs also has conventional non-incremental search commands, which
  841. require you type the entire search string before searching begins.
  842.  
  843. `C-s RET STRING RET'
  844.      Search for STRING.
  845.  
  846. `C-r RET STRING RET'
  847.      Search backward for STRING.
  848.  
  849.    To do a non-incremental search, first type `C-s RET' (or `C-s C-m').
  850. This enters the minibuffer to read the search string.  Terminate the
  851. string with RET to start the search.  If the string is not found, the
  852. search command gets an error.
  853.  
  854.    By default, `C-s' invokes incremental search, but if you give it an
  855. empty argument, which would otherwise be useless, it invokes
  856. non-incremental search.  Therefore, `C-s RET' invokes non-incremental
  857. search.  `C-r RET' also works this way.
  858.  
  859.    Forward and backward non-incremental searches are implemented by the
  860. commands `search-forward' and `search-backward'.  You can bind these
  861. commands to keys.  The reason that incremental search is programmed to
  862. invoke them as well is that `C-s RET' is the traditional sequence of
  863. characters used in Emacs to invoke non-incremental search.
  864.  
  865.    Non-incremental searches performed using `C-s RET' do not call
  866. `search-forward' right away.  They first check if the next character is
  867. `C-w', which requests a word search.
  868.  
  869.    *Note Word Search::.
  870.  
  871. 
  872. File: xemacs.info,  Node: Word Search,  Next: Regexp Search,  Prev: Non-Incremental Search,  Up: Search
  873.  
  874. Word Search
  875. ===========
  876.  
  877.    Word search looks for a sequence of words without regard to how the
  878. words are separated.  More precisely, you type a string of many words,
  879. using single spaces to separate them, and the string is found even if
  880. there are multiple spaces, newlines or other punctuation between the
  881. words.
  882.  
  883.    Word search is useful in editing documents formatted by text
  884. formatters.  If you edit while looking at the printed, formatted
  885. version, you can't tell where the line breaks are in the source file.
  886. Word search, allows you to search  without having to know the line
  887. breaks.
  888.  
  889. `C-s RET C-w WORDS RET'
  890.      Search for WORDS, ignoring differences in punctuation.
  891.  
  892. `C-r RET C-w WORDS RET'
  893.      Search backward for WORDS, ignoring differences in punctuation.
  894.  
  895.    Word search is a special case of non-incremental search.  It is
  896. invoked with `C-s RET C-w' followed by the search string, which must
  897. always be terminated with another RET.  Being non-incremental, this
  898. search does not start until the argument is terminated.  It works by
  899. constructing a regular expression and searching for that.  *Note Regexp
  900. Search::.
  901.  
  902.    You can do a backward word search with `C-r RET C-w'.
  903.  
  904.    Forward and backward word searches are implemented by the commands
  905. `word-search-forward' and `word-search-backward'.  You can bind these
  906. commands to keys.  The reason that incremental search is programmed to
  907. invoke them as well is that `C-s RET C-w' is the traditional Emacs
  908. sequence of keys for word search.
  909.  
  910. 
  911. File: xemacs.info,  Node: Regexp Search,  Next: Regexps,  Prev: Word Search,  Up: Search
  912.  
  913. Regular Expression Search
  914. =========================
  915.  
  916.    A "regular expression" ("regexp", for short) is a pattern that
  917. denotes a set of strings, possibly an infinite set.  Searching for
  918. matches for a regexp is a powerful operation that editors on Unix
  919. systems have traditionally offered.  In XEmacs, you can search for the
  920. next match for a regexp either incrementally or not.
  921.  
  922.    Incremental search for a regexp is done by typing `M-C-s'
  923. (`isearch-forward-regexp').  This command reads a search string
  924. incrementally just like `C-s', but it treats the search string as a
  925. regexp rather than looking for an exact match against the text in the
  926. buffer.  Each time you add text to the search string, you make the
  927. regexp longer, and the new regexp is searched for.  A reverse regexp
  928. search command `isearch-backward-regexp' also exists, but no key runs
  929. it.
  930.  
  931.    All of the control characters that do special things within an
  932. ordinary incremental search have the same functionality in incremental
  933. regexp search.  Typing `C-s' or `C-r' immediately after starting a
  934. search retrieves the last incremental search regexp used: incremental
  935. regexp and non-regexp searches have independent defaults.
  936.  
  937.    Non-incremental search for a regexp is done by the functions
  938. `re-search-forward' and `re-search-backward'.  You can invoke them with
  939. `M-x' or bind them to keys.  You can also call `re-search-forward' by
  940. way of incremental regexp search with `M-C-s RET'.
  941.  
  942. 
  943. File: xemacs.info,  Node: Regexps,  Next: Search Case,  Prev: Regexp Search,  Up: Search
  944.  
  945. Syntax of Regular Expressions
  946. =============================
  947.  
  948.    Regular expressions have a syntax in which a few characters are
  949. special constructs and the rest are "ordinary".  An ordinary character
  950. is a simple regular expression which matches that character and nothing
  951. else.  The special characters are `$', `^', `.', `*', `+', `?', `[',
  952. `]' and `\'; no new special characters will be defined.  Any other
  953. character appearing in a regular expression is ordinary, unless a `\'
  954. precedes it.
  955.  
  956.    For example, `f' is not a special character, so it is ordinary, and
  957. therefore `f' is a regular expression that matches the string `f' and
  958. no other string.  (It does not match the string `ff'.)  Likewise, `o'
  959. is a regular expression that matches only `o'.
  960.  
  961.    Any two regular expressions A and B can be concatenated.  The result
  962. is a regular expression which matches a string if A matches some amount
  963. of the beginning of that string and B matches the rest of the string.
  964.  
  965.    As a simple example, you can concatenate the regular expressions `f'
  966. and `o' to get the regular expression `fo', which matches only the
  967. string `fo'.  To do something nontrivial, you need to use one of the
  968. following special characters:
  969.  
  970. `. (Period)'
  971.      is a special character that matches any single character except a
  972.      newline.  Using concatenation, you can make regular expressions
  973.      like `a.b', which matches any three-character string which begins
  974.      with `a' and ends with `b'.
  975.  
  976. `*'
  977.      is not a construct by itself; it is a suffix, which means the
  978.      preceding regular expression is to be repeated as many times as
  979.      possible.  In `fo*', the `*' applies to the `o', so `fo*' matches
  980.      one `f' followed by any number of `o's.  The case of zero `o's is
  981.      allowed: `fo*' does match `f'.
  982.  
  983.      `*' always applies to the smallest possible preceding expression.
  984.      Thus, `fo*' has a repeating `o', not a repeating `fo'.
  985.  
  986.      The matcher processes a `*' construct by immediately matching as
  987.      many repetitions as it can find.  Then it continues with the rest
  988.      of the pattern.  If that fails, backtracking occurs, discarding
  989.      some of the matches of the `*'-modified construct in case that
  990.      makes it possible to match the rest of the pattern.  For example,
  991.      matching `ca*ar' against the string `caaar', the `a*' first tries
  992.      to match all three `a's; but the rest of the pattern is `ar' and
  993.      there is only `r' left to match, so this try fails.  The next
  994.      alternative is for `a*' to match only two `a's.  With this choice,
  995.      the rest of the regexp matches successfully.
  996.  
  997. `+'
  998.      is a suffix character similar to `*' except that it requires that
  999.      the preceding expression be matched at least once.  For example,
  1000.      `ca+r' will match the strings `car' and `caaaar' but not the
  1001.      string `cr', whereas `ca*r' would match all three strings.
  1002.  
  1003. `?'
  1004.      is a suffix character similar to `*' except that it can match the
  1005.      preceding expression either once or not at all.  For example,
  1006.      `ca?r' will match `car' or `cr'; nothing else.
  1007.  
  1008. `[ ... ]'
  1009.      `[' begins a "character set", which is terminated by a `]'.  In
  1010.      the simplest case, the characters between the two form the set.
  1011.      Thus, `[ad]' matches either one `a' or one `d', and `[ad]*'
  1012.      matches any string composed of just `a's and `d's (including the
  1013.      empty string), from which it follows that `c[ad]*r' matches `cr',
  1014.      `car', `cdr', `caddaar', etc.
  1015.  
  1016.      You can include character ranges in a character set by writing two
  1017.      characters with a `-' between them.  Thus, `[a-z]' matches any
  1018.      lower-case letter.  Ranges may be intermixed freely with
  1019.      individual characters, as in `[a-z$%.]', which matches any lower-
  1020.      case letter or `$', `%', or period.
  1021.  
  1022.      Note that inside a character set the usual special characters are
  1023.      not special any more.  A completely different set of special
  1024.      characters exists inside character sets: `]', `-', and `^'.
  1025.  
  1026.      To include a `]' in a character set, you must make it the first
  1027.      character.  For example, `[]a]' matches `]' or `a'.  To include a
  1028.      `-', write `---', which is a range containing only `-'.  To
  1029.      include `^', make it other than the first character in the set.
  1030.  
  1031. `[^ ... ]'
  1032.      `[^' begins a "complement character set", which matches any
  1033.      character except the ones specified.  Thus, `[^a-z0-9A-Z]' matches
  1034.      all characters except letters and digits.
  1035.  
  1036.      `^' is not special in a character set unless it is the first
  1037.      character.  The character following the `^' is treated as if it
  1038.      were first (`-' and `]' are not special there).
  1039.  
  1040.      Note that a complement character set can match a newline, unless
  1041.      newline is mentioned as one of the characters not to match.
  1042.  
  1043. `^'
  1044.      is a special character that matches the empty string, but only if
  1045.      at the beginning of a line in the text being matched.  Otherwise,
  1046.      it fails to match anything.  Thus, `^foo' matches a `foo' that
  1047.      occurs at the beginning of a line.
  1048.  
  1049. `$'
  1050.      is similar to `^' but matches only at the end of a line.  Thus,
  1051.      `xx*$' matches a string of one `x' or more at the end of a line.
  1052.  
  1053. `\'
  1054.      does two things: it quotes the special characters (including `\'),
  1055.      and it introduces additional special constructs.
  1056.  
  1057.      Because `\' quotes special characters, `\$' is a regular
  1058.      expression that matches only `$', and `\[' is a regular expression
  1059.      that matches only `[', and so on.
  1060.  
  1061.    Note: for historical compatibility, special characters are treated as
  1062. ordinary ones if they are in contexts where their special meanings make
  1063. no sense.  For example, `*foo' treats `*' as ordinary since there is no
  1064. preceding expression on which the `*' can act.  It is poor practice to
  1065. depend on this behavior; better to quote the special character anyway,
  1066. regardless of where is appears.
  1067.  
  1068.    Usually, `\' followed by any character matches only that character.
  1069. However, there are several exceptions: characters which, when preceded
  1070. by `\', are special constructs.  Such characters are always ordinary
  1071. when encountered on their own.  Here is a table of `\' constructs.
  1072.  
  1073. `\|'
  1074.      specifies an alternative.  Two regular expressions A and B with
  1075.      `\|' in between form an expression that matches anything A or B
  1076.      matches.
  1077.  
  1078.      Thus, `foo\|bar' matches either `foo' or `bar' but no other string.
  1079.  
  1080.      `\|' applies to the largest possible surrounding expressions.
  1081.      Only a surrounding `\( ... \)' grouping can limit the grouping
  1082.      power of `\|'.
  1083.  
  1084.      Full backtracking capability exists to handle multiple uses of
  1085.      `\|'.
  1086.  
  1087. `\( ... \)'
  1088.      is a grouping construct that serves three purposes:
  1089.  
  1090.        1. To enclose a set of `\|' alternatives for other operations.
  1091.           Thus, `\(foo\|bar\)x' matches either `foox' or `barx'.
  1092.  
  1093.        2. To enclose a complicated expression for the postfix `*' to
  1094.           operate on.  Thus, `ba\(na\)*' matches `bananana', etc., with
  1095.           any (zero or more) number of `na' strings.
  1096.  
  1097.        3. To mark a matched substring for future reference.
  1098.  
  1099.  
  1100.      This last application is not a consequence of the idea of a
  1101.      parenthetical grouping; it is a separate feature which happens to
  1102.      be assigned as a second meaning to the same `\( ... \)' construct
  1103.      because in practice there is no conflict between the two meanings.
  1104.      Here is an explanation:
  1105.  
  1106. `\DIGIT'
  1107.      after the end of a `\( ... \)' construct, the matcher remembers the
  1108.      beginning and end of the text matched by that construct.  Then,
  1109.      later on in the regular expression, you can use `\' followed by
  1110.      DIGIT to mean "match the same text matched the DIGIT'th time by the
  1111.      `\( ... \)' construct."
  1112.  
  1113.      The strings matching the first nine `\( ... \)' constructs
  1114.      appearing in a regular expression are assigned numbers 1 through 9
  1115.      in order that the open-parentheses appear in the regular
  1116.      expression.  `\1' through `\9' may be used to refer to the text
  1117.      matched by the corresponding `\( ... \)' construct.
  1118.  
  1119.      For example, `\(.*\)\1' matches any newline-free string that is
  1120.      composed of two identical halves.  The `\(.*\)' matches the first
  1121.      half, which may be anything, but the `\1' that follows must match
  1122.      the same exact text.
  1123.  
  1124. `\`'
  1125.      matches the empty string, provided it is at the beginning of the
  1126.      buffer.
  1127.  
  1128. `\''
  1129.      matches the empty string, provided it is at the end of the buffer.
  1130.  
  1131. `\b'
  1132.      matches the empty string, provided it is at the beginning or end
  1133.      of a word.  Thus, `\bfoo\b' matches any occurrence of `foo' as a
  1134.      separate word.  `\bballs?\b' matches `ball' or `balls' as a
  1135.      separate word.
  1136.  
  1137. `\B'
  1138.      matches the empty string, provided it is not at the beginning or
  1139.      end of a word.
  1140.  
  1141. `\<'
  1142.      matches the empty string, provided it is at the beginning of a
  1143.      word.
  1144.  
  1145. `\>'
  1146.      matches the empty string, provided it is at the end of a word.
  1147.  
  1148. `\w'
  1149.      matches any word-constituent character.  The editor syntax table
  1150.      determines which characters these are.
  1151.  
  1152. `\W'
  1153.      matches any character that is not a word-constituent.
  1154.  
  1155. `\sCODE'
  1156.      matches any character whose syntax is CODE.  CODE is a character
  1157.      which represents a syntax code: thus, `w' for word constituent,
  1158.      `-' for whitespace, `(' for open-parenthesis, etc.  *Note Syntax::.
  1159.  
  1160. `\SCODE'
  1161.      matches any character whose syntax is not CODE.
  1162.  
  1163.    Here is a complicated regexp used by Emacs to recognize the end of a
  1164. sentence together with any whitespace that follows.  It is given in Lisp
  1165. syntax to enable you to distinguish the spaces from the tab characters.
  1166. In Lisp syntax, the string constant begins and ends with a
  1167. double-quote.  `\"' stands for a double-quote as part of the regexp,
  1168. `\\' for a backslash as part of the regexp, `\t' for a tab and `\n' for
  1169. a newline.
  1170.  
  1171.      "[.?!][]\"')]*\\($\\|\t\\|  \\)[ \t\n]*"
  1172.  
  1173. This regexp contains four parts: a character set matching period, `?'
  1174. or `!'; a character set matching close-brackets, quotes or parentheses,
  1175. repeated any number of times; an alternative in backslash-parentheses
  1176. that matches end-of-line, a tab or two spaces; and a character set
  1177. matching whitespace characters, repeated any number of times.
  1178.  
  1179.